<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
</head>

<body>
<?php
function GetIpLookup($ip = '')
{
if(empty($ip))
{
$ip = GetIp();
}
$res = @file_get_contents('http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js&ip=' . $ip);
if(empty($res))
{
return false;
}
$jsonMatches = array();
preg_match('#\{.+?\}#', $res, $jsonMatches);
if(!isset($jsonMatches[0]))
{
return false;
}
$json = json_decode($jsonMatches[0], true);
if(isset($json['ret']) && $json['ret'] == 1)
{
$json['ip'] = $ip;
unset($json['ret']);
}else{
return false;
}
return $json;
}
$ipInfos = GetIpLookup('123.125.114.144'); //baidu.com IP地址 


?>
</body>
</html>